﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ERP仓储管理系统</title>
<link href="/css/style.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        #yzm{
            width:222px;
            height: 40px;
            background-color: orange;
            font-size: 18px;
        }

        #verify-pic{
            position: absolute;
            top: 214px;
            left: 510px;
            width: 120px;
            height: 50px;
        }
    </style>
<script language="JavaScript" src="js/jquery.js"></script>
<!--<script src="/js/cloud.js" type="text/javascript"></script>-->
<!--<script type="text/javascript" src="/js/js.cookie.js"></script>-->
<!--<script type="text/javascript" src="/js/login/login.js"></script>-->
<script language="javascript">
	$(function(){
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
	$(window).resize(function(){  
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
    })  
});  
</script> 

</head>

<body style="background-color:#df7611; background-image:url(/images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">

    <div id="mainBody">
      <div id="cloud1" class="cloud"></div>
      <div id="cloud2" class="cloud"></div>
    </div>  


	<div class="logintop">    
        <span>ERP仓储管理系统</span>   
    </div>
    
    <div class="loginbody">
    
    <span class="systemlogo"></span> 
       
    <div class="loginbox loginbox1">
    
    <ul>
    <li><input name="" id="name" type="text" class="loginuser" value="admin" onclick="JavaScript:this.value=''"/></li>
    <li><input name="" id="pwd" type="text" class="loginpwd" value="密码" onclick="JavaScript:this.value=''"/></li>

    <li class="yzm">
        <input type="text" name="yzm" id="yzm" value="验证码" onclick="JavaScript:this.value=''">
        <img src="/user/toVerifyPic" id="verify-pic" class="mg"><br><br>
    </li>

    <li><input name="" type="button" class="loginbtn" value="登录"  id="loginButton" /><label><input name="" type="checkbox" value="" checked="checked" />记住密码</label><label><a href="#">忘记密码？</a></label></li>
    </ul>
    
    </div>
    
    </div>
    
    
    <div class="loginbm">版权归南昌朝腾科技所有，仅供学习交流，勿用于任何商业用途</div>
	
    
</body>

</html>
<script>
    var img=document.getElementById("verify-pic");
    img.onclick=function () {
        var date=new Date().getTime();
        img.src="/user/toVerifyPic?"+date;
    }

    function fun() {
        var name = $("#name").val();
        var pwd = $("#pwd").val();
        if (name!=null && name!="" && pwd!=null && pwd!=""){
            return true;
        }else {
            return false;
        }
    }


        $("#loginButton").click(function () {
            if (fun()){

            var name = $("#name").val();
            var pwd = $("#pwd").val();
            var yzm = $("#yzm").val();
            $.ajax({
                url:"/user/login/"+name+"/"+pwd+"/"+yzm,
                type:"POST",
                data:{},
                dataType: "json",
                success: function (r) {
                    if (r=="one"){
                        alert("登录成功！")
                        location.href="main.html"
                    }else if(r=="two"){
                        alert("用户名或密码错误！")
                        location.href="login.html"
                    }else if(r=="three"){
                        alert("验证码错误!")
                        location.href="login.html"
                    }
                    // location.href="success.jsp";
                },
                error:function(n){
                    alert("!!!!!!!!!")
                }
            })
            }else {
                alert("请输入用户名密码！")
            }

        })





</script>